﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using ScFramework.Core;
using UnityEngine.UI;
using System;

public class ItemCell: MonoBehaviour
{
    /// <summary>
    /// 共有字段，表示当前选中的编号。
    /// </summary>
    
    static int _num = 1;
    Transform panel;
    public GameObject draggedImage;
    public static List<Tuple<GameObject, MeshEntityData>> ItemsList;
    private void Awake()
    {
        panel = this.transform.parent;
    }
    private void Update()
    {
        draggedImage.transform.position =Input.mousePosition;
    }
    private void OnMouseDown()
    {
        
    }
    public void PointDown()
    {
        panel.Find("bag_" + _num).gameObject.GetComponent<Image>().color = Color.white;
        _num = this.transform.name[4]-48;
        this.gameObject.GetComponent<Image>().color = Color.gray;
    }
    public void PointUp()
    {
        this.gameObject.GetComponent<Image>().color = Color.white;
        draggedImage.SetActive(false);

    }
    public void PointClick()
    {
        panel.Find("bag_" + _num).gameObject.GetComponent<Image>().color = Color.white;
        _num = this.transform.name[4]-48;
        this.gameObject.GetComponent<Image>().color = Color.gray;
        //选中物体改变发消息
    }
    public void PointDrag()
    {
        draggedImage.SetActive(true);
        draggedImage.GetComponent<Image>().sprite = this.transform.Find("Image").GetComponent<Image>().sprite;
    }
}
